package com.mgface.framework.component;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.mgface.framework.interceptor.AssignCommonInterceptor;
/**
 * 为应用程序添加拦截器
 * @author user
 *
 */
@Component
public class SBDWebAppConfigurer extends WebMvcConfigurerAdapter{
	@Value("${system.name:mgface}")
	private String projectName;
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new AssignCommonInterceptor(projectName)).addPathPatterns("/**").excludePathPatterns("/sbdstatic/**");
		super.addInterceptors(registry);
	}
	@Override
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		registry.addResourceHandler("/sbdstatic/**").addResourceLocations("classpath:/static/");
		super.addResourceHandlers(registry);
	}
}
